/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Resultados.java
 *
 * Created on 16-dic-2009, 14:38:24
 */

package interfazbuscador;

import java.io.PrintStream;
import java.util.List;
import logica.Buscador;

/**
 *
 * @author usuario_local
 */
public class Resultados extends javax.swing.JPanel {

    /** Creates new form Resultados */
    public Resultados(String busqueda) {
        initComponents();
        setSize(400,300);


      //  palabraBuscada.setText(busqueda);
        System.out.println("probando busqueda  "+busqueda);
        /**
         * funcion buscar de esta gente
         * */
        
		try {
			List<String> x;
			x = Buscador.consultar(busqueda);
	        for (int i=0; i < x.size(); i++){

	            System.setOut(new PrintStream(new TextAreaOutputStream(jTextArea1)));
	            System.out.println(x.get(i));
	        }
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        TextoResultado = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        palabraBuscada = new javax.swing.JTextField();

        setBackground(new java.awt.Color(204, 255, 102));

        TextoResultado.setText("Resultados para..");
        TextoResultado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TextoResultadoActionPerformed(evt);
            }
        });

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jScrollPane1.setViewportView(jTextArea1);

        palabraBuscada.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                palabraBuscadaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(82, 82, 82)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 227, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(TextoResultado, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(36, 36, 36)
                        .addComponent(palabraBuscada, javax.swing.GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(35, 35, 35)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(TextoResultado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(palabraBuscada, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(33, 33, 33)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(50, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void TextoResultadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TextoResultadoActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_TextoResultadoActionPerformed

    private void palabraBuscadaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_palabraBuscadaActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_palabraBuscadaActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField TextoResultado;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextField palabraBuscada;
    // End of variables declaration//GEN-END:variables

}
